
#ifndef _LOG_DEFINES_H_
#define _LOG_DEFINES_H_

#include <string>
using namespace std;

namespace trident
{

#define SECONDS_OF_DAY          (86400)
#define FILE_DEFAULT_MAX_SIZE   (100 * 1024 * 1024)          // 100M
#define LOG_THREAD_TIMEOUT      (60 * 1000)                  // 1 minutes

// enum log level
enum log_level_e
{
    LOG_LEVEL_OFF = 0,
    LOG_LEVEL_FATAL,
    LOG_LEVEL_ERROR,
    LOG_LEVEL_WARN,
    LOG_LEVEL_INFO,
    LOG_LEVEL_DEBUG,
    LOG_LEVEL_TRACE,
    LOG_LEVEL_NUM
};

// log level str
static const char* log_level_str[] = 
{
    "[  OFF]",
    "[FATAL]",
    "[ERROR]",
    "[ WARN]",
    "[ INFO]",
    "[DEBUG]",
    "[TRACE]"
};

// log format defines
#define LOG_FMT_DATE            0x00000001      // 2011-11-30 15:40:57
#define LOG_FMT_MSECOND         0x00000002      // 8888888
#define LOG_FMT_LEVEL           0x00000004      // [DEBUG]

// log queue type
enum log_queue_type_e
{
    LOG_QUEUE_DATA = 0,             // normal data
    LOG_QUEUE_QUIT,                 // quit cmd
};

// log thread queue data
struct log_queue_data_t
{
    log_queue_data_t(log_queue_type_e log_queue_type_,
        log_level_e log_level_, const char* data_)
        : _type(log_queue_type_), _level(log_level_), _data(data_)
    {
    }

    log_queue_data_t(const log_queue_data_t& log_queue_data_)
        : _type(log_queue_data_._type), _level(log_queue_data_._level),
        _data(log_queue_data_._data)
    {
    }

    log_queue_data_t& operator=(const log_queue_data_t& log_queue_data_)
    {
        _type = log_queue_data_._type;
        _level = log_queue_data_._level;
        _data = log_queue_data_._data;

        return *this;
    }

    log_queue_type_e        _type;
    log_level_e             _level;
    string                  _data;
};

} // namespace trident

#endif //_LOG_DEFINES_H_
